<?php

namespace common\validate;


class Order extends BaseValidate
{
    // 验证规则
    protected $rule = [];


    // Fields 验证场景定义
    public function sceneFields()
    {
        return $this;
    }

    // Find 验证场景定义
    public function sceneFind()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array');
    }

    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array')
            ->append('param.page', 'array');
    }

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this->append("data", "require|array");
    }

    // Order 验证场景定义
    public function sceneOrder()
    {
        return $this
            ->append("tenant_id", "require")
//            ->append("man_day_number", "require")
            ->append("step_category_id", "require|integer")
            ->append("project_id", "require|integer")
            ->append("party_a_person_in_charge", "require|integer")
            ->append("reviewer_user_id", "require|integer")
            ->append("reviewer_role_code", "require")
            ->append("money", "require|lt:9999999999999999999")
//            ->append("man_day", "require")
            ->append("param", "array")
            ->append("task_list", "require|array")
            ->append("type", "in:outside,tenant_group");
    }

    // OrderTaskList 验证场景定义
    public function sceneOrderTaskList()
    {
        return $this
            ->append("task_id", "require|integer")
            ->append("money", "require|lt:9999999999999999")
            ->append("start_time", "require|integer")
            ->append("end_time", "require|integer")
            ->append("entity_id", "require|integer")
            ->append("cost_man_hour", "lt:9999999999999999999");
    }

    // GetOrderList 验证场景定义
    public function sceneGetOrderList()
    {
        return $this->append("param.filter", "array")
            ->append("param.type", "require|in:0,1")
            ->append("param.order", "max:128")
            ->append("param.page", "array");
    }

    // GetOrderDetail 验证场景定义
    public function sceneGetOrderDetail()
    {
        return $this->append("param.filter", "require|array");
    }

    // UpdateOrder 验证场景定义
    public function sceneUpdateOrder()
    {
        return $this->append("data", "require|array")
            ->append("data.id", "require|integer|max:11")
            ->append("data.reviewer_user_id", "require|integer|max:11")
            ->append("data.reviewer_role_code", "require")
            ->append("data.task_list", "array");
    }

    // UpdateOrderTaskList 验证场景定义
    public function sceneUpdateOrderTaskList()
    {
        return $this
            ->append("id", "require|integer")
            ->append("task_id", "require|integer")
            ->append("entity_id", "require|integer")
            ->append("money", "require|lt:9999999999999999")
            ->append("cost_man_hour", "require|lt:9999999999999999999");
    }

    // PartyBAcceptOrder 验证场景定义
    public function scenePartyBAcceptOrder()
    {
        return $this->append("id", "require|integer")
            ->append('party_b_resp_producer_id', 'require|integer');
    }

    // GetMyReviewOrderCount 验证场景定义
    public function sceneGetMyReviewOrderCount()
    {
        return $this->append("param", "array");
    }

    // GetMyReviewOrderList 验证场景定义
    public function sceneGetMyReviewOrderList()
    {
        return $this->append("param", "array")
            ->append("param.filter", "array")
            ->append("param.page", "array");
    }

    // GetWaitForAddSettlementOrderList 验证场景定义
    public function sceneGetWaitForAddSettlementOrderList(): Order
    {
        return $this->append("param.filter", "array")
            ->append("param.order", "max:128")
            ->append("param.page", "array");
    }

    // PartyBHandleOrder 验证场景定义
    public function scenePartyBHandleOrder(): Order
    {
        return $this->append("id", "require|integer")
            ->append('is_accept', 'require|in:yes,no')
            ->append('party_b_resp_producer_id', 'require|integer');
    }

    // GeneratePlaylistPackage 验证场景定义
    public function sceneGeneratePlaylistPackage()
    {
        return $this->append('id', 'require|integer');
    }

    // UpdateOrderFileStatus 验证场景定义
    public function sceneUpdateOrderFileStatus()
    {
        return $this->append("id", "require|integer");
    }

    // GeneratedOrderTaskFileList 验证场景定义
    public function sceneGeneratedOrderTaskFileList()
    {
        return $this
            ->append('param.is_async', 'in:yes,no')
            ->append('param.order_id', 'require|integer');
    }

    // Withdrawn 验证场景定义
    public function sceneWithdrawn()
    {
        return $this->append('param.filter.id', 'require|integer');
    }

    // GetOrderTaskReviewList 验证场景定义
    public function sceneGetOrderTaskReviewList()
    {
        return $this->append('param.order_id', 'require|integer')
            ->append('param.filter', 'array');
    }

    // SubmitOrderTaskListReview 验证场景定义
    public function sceneSubmitOrderTaskListReview()
    {
        return $this->append('data.task_id_list', 'require|array')
            ->append('data.order_id', 'require|integer');
    }

    // PartybHandleReviewNote 验证场景定义
    public function scenePartybHandleReviewNote()
    {
        return $this->append('param.review_request_node_id', 'require|integer')
            ->append('param.accept', 'require|in:yes,no');
    }

    // GetProjectList 验证场景定义
    public function sceneGetProjectList()
    {
        return $this->append('param.type', 'require')
            ->append('param.fields', 'require');
    }

    // GetOrderTaskReviewList 验证场景定义
    public function sceneGetAllOrderTaskReviewList()
    {
        return $this->append('param.filter', 'array');
    }

    // GetOrderList 验证场景定义
    public function sceneGetMySelfOutsideReviewOrderList()
    {
        return $this->append("param.filter", "array")
            ->append("param.order", "max:128")
            ->append("param.page", "array");
    }

    // GetTenantGroupOrder 验证场景定义
    public function sceneGetTenantGroupOrder()
    {
        return $this->append("param.filter", "require");
    }

    // SetTenantGroupStepTaskExecutor 验证场景定义
    public function sceneSetTenantGroupStepTaskExecutor()
    {
        return $this->append("param.order_id", "require|number");
    }
}
